<%-- 
    Document   : mem_details
    Created on : Oct 7, 2009, 3:36:00 AM
    Author     : bharath
--%>
<jsp:useBean id ="ms" scope="session" class="Login.MySqlConnector"/>
<jsp:setProperty name="ms" property="*" />
<%@ page import="java.io.* ,java.util.*, java.sql.*, Login.* , javax.servlet.http.* , Registration.* " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>SCF - Who's Who</title>
        <link rel="stylesheet" href="./css/yellow.css" />
        <link rel="stylesheet" href="./css/small.css" />

        <!-- Loading Calendar JavaScript files -->
        <script type="text/javascript" src="./js/zapatec.js"></script>
        <script type="text/javascript" src="./js/calendar.js"></script>
        <!-- Loading language definition file -->
        <script type="text/javascript" src="./js/calendar-en.js"></script>
        <meta http-equiv="content-type" content="text/xml; charset=utf-8" />

        <style type="text/css">
            <!--
            body
            {
                margin-top:0;
                margin-left:0;
            }
            .style36 {	color: #FFFFFF;
                font-style: italic;
                font-weight: bold;
            }
            .style35 {font-family: Arial, Helvetica, sans-serif;
                font-size: 14px;
                color: #0D62A2;
                font-weight: bold;
            }
            .style37 {font-size: 18px;
                color: #053C7C;
            }
            .style39 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #FF0000; font-weight: bold; }
            .style40 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #FFFFFF; font-weight: bold; }
            .style41 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #00CCCC; font-weight: bold; }
.style43 {color: #000000}
.style44 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #000000; font-weight: bold; }
.style45 {color: #FFFF66}
.style46 {
	font-family: "Monotype Corsiva";
	font-size: 24px;
}
            -->
        </style>
        <script type="text/javascript">
            var d1;
            function getXMLObject()  //XML OBJECT
            {
                var xmlHttp = false;
                try {
                    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
                }
                catch (e) {
                    try {
                        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
                    }
                    catch (e2) {
                        xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
                    }
                }
                if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
                    xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
                }
                return xmlHttp;  // Mandatory Statement returning the ajax object created
            }

            var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax object

            function getDistricts() {
                var sel = document.getElementById("state");
                var opt = sel.options[sel.selectedIndex];
                var d = opt.value || opt.text;
                if(xmlhttp) {
                    xmlhttp.open("GET","AJAXGetDistricts?state=" +d,true);
                    xmlhttp.onreadystatechange  = handleServerResponse;
                    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlhttp.send(null);
                }
            }

        /*    function getMandals() {
                var districts = document.getElementById("district");
                var opt1 = districts.options[districts.selectedIndex];
                var d1= opt1.value || opt1.text;
                alert(",,,,,,,,,,,,,,,,,,");
                if(xmlhttp) {
                    xmlhttp.open("GET","AJAXGetMandals?district=" +d1,true);
                    xmlhttp.onreadystatechange  = handleServerResponse1;
                    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlhttp.send(null);
                }
            }
          */
		    function getMemDetails()
            {
                var districts = document.getElementById("district");
                var opt1 = districts.options[districts.selectedIndex];
                var d1= opt1.value || opt1.text;
                	
				var profession = document.getElementById("prof");
                var opt2 = profession.options[profession.selectedIndex];
                var d2 = opt2.value || opt2.text;
									
				var sel = document.getElementById("state");
                var opt = sel.options[sel.selectedIndex];
                var d = opt.value || opt.text;
				                
                if(xmlhttp)
                {
                    xmlhttp.open("GET","AJAXGetMemDetails?district="+d1+"&state="+d+"&prof="+d2,true);
                    xmlhttp.onreadystatechange  = handleServerResponse2;
                    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlhttp.send(null);
                }
            }

            function handleServerResponse() {
                if (xmlhttp.readyState == 4) {
                    if(xmlhttp.status == 200) {
                        document.getElementById('district').options.length = 0;
                        var elemnt = document.getElementById("district");
                        var textToSplit = xmlhttp.responseText;
                        var returnElements=textToSplit.split("|");
                        var valueLabelPair=null;
                        document.getElementById('district').options[0] = new Option("Select","select");
                        for ( var i=0; i<(returnElements.length-1); i++ ){
                            valueLabelPair = returnElements[i].split("|");
                            document.getElementById('district').options[i+1] = new Option(valueLabelPair[0], valueLabelPair[1]);
                        }
                    }else {
                        alert("AJAX Call Error Please try again");
                    }
                }
            }

         /*   function handleServerResponse1() {
                if (xmlhttp.readyState == 4) {
                    if(xmlhttp.status == 200) {
                        document.getElementById('mandal').options.length = 0;
                        var elemnt = document.getElementById("mandal");
                        var textToSplit = xmlhttp.responseText;
                        var returnElements=textToSplit.split("|");
                        var valueLabelPair=null;
                        for ( var i=0; i<(returnElements.length-1); i++ ){
                            document.getElementById('mandal').options[i] = new Option("","");
                        }
                        document.getElementById('mandal').options[0] = new Option("Select","select");
                        for ( var i=0; i<(returnElements.length-1); i++ ){
                            valueLabelPair = returnElements[i].split("|");
                            document.getElementById('mandal').options[i+1] = new Option(valueLabelPair[0], valueLabelPair[1]);
                        }
                    }else {
                        alert("Error during AJAX call. Please try again");
                    }
                }
            }*/
            function handleServerResponse2() {
                if (xmlhttp.readyState == 4) {
                    if(xmlhttp.status == 200)
                    {
                        document.getElementById('doctors').options.length = 0;
                        var elemnt = document.getElementById("doctors");
                        var textToSplit = xmlhttp.responseText;
                        var returnElements=textToSplit.split("&");
						var valueLabelPair=null;
                        for ( var i=0; i<(returnElements.length-1); i++ )
						{
                            document.getElementById('doctors').options[i] = new Option("","");
                        }
                        document.getElementById('doctors').options[0] = new Option("Select","select");
                        for (var i=0; i<(returnElements.length-1); i++ )
						{                            
                           valueLabelPair = returnElements[i].split("&");
                           document.getElementById('doctors').options[i+1] = new Option(valueLabelPair[0], valueLabelPair[1]);
                        }
                    }
                    else
                      alert("Error during AJAX call. Please try again");
               }
            }
        </script>
    </head>
    <body>
        <table width="86%" height="344" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#0C61A1">
            <tr>
                <td height="21" colspan="2" align="center" valign="top" bgcolor="#0D62A2"><span class="style36">WHO'S WHO </span></td>
            </tr>
            <tr>
                <td colspan="2" align="center" valign="top" bgcolor="#FDFEE9"><form id="form1" name="form1" method="post" action="">
                        <table width="831" height="424" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000">
                            <tr>
                                <td height="27" colspan="4" bgcolor="#FFFF00" class="style35"><div align="center" class="style37">Member Search &nbsp;</div></td>

                                <%
        HttpSession hs = request.getSession(true);
        String memid = (String) hs.getAttribute("memid");
        System.out.println("member id is " + memid);
        						%>
                            </tr>
                            <tr>
                                <td bgcolor="#0D62A2" class="style39"><a href="javascript:history.go(-1)">Back</a></td>
                                <td bgcolor="#0D62A2" class="style40"><span class="style39">Hi &quot;<%=memid%>&quot; </span></td>
                                <td rowspan="2" bgcolor="#0D62A2" class="style39">&nbsp;</td>
                                <td rowspan="2" bgcolor="#0D62A2" class="style39"></td>
                            </tr>
                            <tr>
                              <td bgcolor="#0D62A2" class="style39">&nbsp;</td>
                                <td bgcolor="#0D62A2" class="style40">&nbsp;</td>
                            </tr>
                            
                            <tr>
                                <td bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td bgcolor="#0D62A2" class="style41 style43">PROFESSION / DESIGNATION : </td>
                                <td width="542" bgcolor="#0D62A2" class="style35">
                                    <div align="left">
                                        <%
        Connection con = ms.Connect();
        String q = "select distinct(profname) from proffession ;";
        PreparedStatement stmt1 = con.prepareStatement(q);
        System.out.println("query is : " + q);
        ResultSet rs1 = stmt1.executeQuery();
        String q1 = "select distinct(state) from states ;";
        System.out.println("query for states is : " + q1);
        PreparedStatement stmt2 = con.prepareStatement(q1);

                                        %>
                                        <select name="prof" id="prof" onChange="javascript:getStates();" style="width:200px">
                                            <option> </option>
                                            <%while (rs1.next() == true) {%>
                                            <option><%=rs1.getString(1)%> </option>
                                        <%}%></select>
                              </div></td>
                                <td width="32" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>
                            <tr>
                                <td bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td bgcolor="#0D62A2" class="style44">State :</td>
                                <td bgcolor="#0D62A2" class="style35">
                                    <div align="left">
                                        <select name="state" id="state" onchange="javascript:getDistricts();">
                                            <option>Select State</option>
                                            <%
        ResultSet staters = stmt2.executeQuery();

        while (staters.next() == true) {%>
                                            <option><%=staters.getString(1)%></option>
                                            <%}%>
                                        </select>
                              </div></td><td bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>
                            <tr>
                                <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td height="21" bgcolor="#0D62A2" class="style44">Districs : </td>
                                <td height="21" bgcolor="#0D62A2" class="style35">
                                  <div align="left">
                                        <select name="district" id="district" onChange="javascript:getMemDetails();" style="width:200px">											
										     <option> </option>
                                            <option value="1" selected="selected">Districts</option>
                                        </select>
                              </div></td>
                                <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>
                            <tr>
                                <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td height="21" bgcolor="#0D62A2" class="style44">&nbsp;</td>
                                <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>
                            <tr>
                              <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                              <td height="21" colspan="2" bgcolor="#0D62A2" class="style39"><div align="center" class="style46">Members Details here </div></td>
                              <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>
                            <tr>
                              <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                              <td height="21" colspan="2" bgcolor="#0D62A2" class="style44">
							  <select name="doctors" size="10" multiple="multiple" id="doctors" style="width:425px">
                                  <option value="1" selected="selected">Names   |   Desig  |  Address  |  Ph No. | Email </option>
                              </select></td>
                              <td height="21" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>

                            <tr>
                                <td width="54" height="21" rowspan="2" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td width="203" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                              <td bgcolor="#0D62A2" class="style35">							  </td>
                                <td rowspan="2" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>
                            <tr>
                                <td bgcolor="#0D62A2" class="style35">&nbsp;</td>
                              <td bgcolor="#0D62A2" class="style35"><input name="Reset" type="reset" id="Submit" value="Reset"  style="width:150px"/></td>
                            </tr>
                            <tr>
                                <td height="40" bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td bgcolor="#0D62A2" class="style35">&nbsp;</td>
                                <td bgcolor="#0D62A2" class="style35">&nbsp;</td>
                            </tr>
                  </table>
                    </form>
                </td>
            </tr>
        </table>
    </body>
</html>

